<?php
loadTemp("admin/models/permission/permission_header.php");
?>
<script type="text/javascript">
$(document).ready(function(){
	loadAdminTopItem();
	activeAdminTopItem("s_c_edit_user");
});
</script>
<?php checkAdminPermission("admin.permission.edit_user","admin.class.*");?>
<!-- Start -->
<script type="text/javascript">
$(document).ready(function(){
	$("#form_edit_user_login_data").hide();
	$("#form_edit_user_profile").hide();
	bindAjaxForm($("#form_edit_user_login_data"),s_edituser_onSuccess,s_edituser_onError,"admin_di");
	bindAjaxForm($("#form_edit_search"),s_edituser_onSuccess,s_edituser_onError,"admin_di");
	bindAjaxForm($("#form_edit_user_profile"),s_edituser_onSuccess,s_edituser_onError,"admin_di");
	
	$(".s_master_selecter").hide();
});
function s_edituser_onSuccess(data){
	console.log(data);
	s_edituser_operatedone(data.code,data.message,data.data);
}
function s_edituser_onError(data){
	console.log(data);
	s_edituser_operatedone(-101,"服务器返回了未知的数据，请上报管理员",data.responseText);
}
function s_edituser_operatedone(id,message,data){
	if(id==-101){
		showMessage("s_edituser_message",-101,message+"<br><br><pre>"+data+"</pre>");
		return;
	}
	if(id!=0&&id!=3){
		showMessage("s_edituser_message",id,message);
	}
	if(id==0){
		showMessage("s_edituser_message",id,message);
	}
	if(data.op=="user_search"){
		$("#form_edit_search").hide();
		$(".s_uid").attr("value",data.uid);
	}
	if(data.op=="edit_done_login"){
		$("#form_edit_user_login_data").hide();
	}
	if(data.op=="edit_done_profile"){
		$("#form_edit_user_profile").hide();
	}
}
</script>
<div class="s_admin_in_container">
	<h2 class="ui dividing header">管理成员权限</h2>
	<div class="ui message">
		<div class="header">小提示</div>
		<ul class="list">
			<li>你可以在这里为用户编辑他们的权限组</li>
			<li>或者单独列出禁止/允许的权限</li>
		</ul>
	</div>
	<div class="ui message hidden" id="s_edituser_message"></div>
	<form class="ui form admin_form" url="admin.php?mod=permission&ajax=true&op=search_edit_user" id="form_edit_search">
		<div class="ui action fluid input">
			<div class="ui left icon input">
				<input type="text" name="account" placeholder="目标账号" id="s_edit_search">
				<i class="users icon"></i>
			</div>
			<button class="ui button submit" type="submit">确定</button>
		</div>
	</form>
	</div>